import request from "@/util/request";

/**
 * 获取登录token
 */
export const auth = (encryptedData,signature,rawData,iv,code,shopId,spreadId,grant_type) => request({
	url: '/blade-auth/oauth/token',
	method: 'post',
	params: {
		grant_type,
		scope: 'all',
		encryptedData,
		signature,
		rawData,
		iv,
		code,
		shopId,
		spreadId
	}
});

export const logout = () => request({
  url: '/blade-auth/oauth/logout'
});

export const getUserInfo = () => request({
  url: '/enjooo-api/member/info'
});

/**
 * 更新会员信息
 * @param {Object} data
 */
export const updateUserInfo = (data) => request({
	url: '/enjooo-api/member/updateUserInfo',
	method: 'post',
	data
});

/**
 * 获取会员卡页面数据
 */
export const getMemberCard = () => request({
  url: '/enjooo-api/member/card/index'
});

/**
 * 获取会员卡页面数据
 */
export const getMemberCardOrder = () => request({
  url: '/enjooo-api/member/card/order'
});

/**
 * 会员服务菜单
 */
export const getMemberService = () => request({
  url: '/enjooo-api/member/service'
});

/**
 * 获取会员信息
 */
export const getMemberCardInfo = (userId) => request({
  url: '/enjooo-api/member/card/info',
  params: {
	  userId
  }
});

export const bindWxPhone = (encryptedData,iv,code) => request({
	url: '/enjooo-api/member/bindWxPhone',
	method: 'post',
	data: {
		encryptedData,
		iv,
		code
	}
});
